package servletUtenteReg;

import java.io.IOException;

import javax.naming.NamingException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class DettaglioFeedbackServlet
 */
public class DettaglioFeedbackServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	private RequestDispatcher dispatcher;
	
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DettaglioFeedbackServlet() {
        
    	super();
    	
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		try {
			eseguiRichiesta(request, response);
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		try {
			eseguiRichiesta(request, response);
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	private void eseguiRichiesta(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, NamingException {
		
		String commento = request.getParameter("dettaglio");
		String session = request.getParameter("session");
		String nome = request.getParameter("nome");
		String cognome = request.getParameter("cognome");
		
		request.setAttribute("commento", commento);
		request.setAttribute("session", session);
		request.setAttribute("nome", nome);
		request.setAttribute("cognome", cognome);
		dispatcher = request.getRequestDispatcher("DettaglioFeedback.jsp");
		dispatcher.forward(request, response);
		
	}
	
}
